<?php include 'site_header.php'; ?>
<?php include 'site_menu.php'; ?>


<link href="<?php echo base_url();?>assets/css/screen.css" rel="stylesheet" type="text/css" />
 
<div id="rightPan">
  	<!--<h1>Sistem Online Pendaftaran Taruna Baru<br /><p>Sekolan Tinggi Meteorologi, Klimatologi, dan Geofisika - Jakarta</p> </h1>-->
	 <h1><p></p> </h1> 
	<div id="ambil">
	
	
				<!-- Content -->
				<div class="wrapper">
					

<?php  if ($is_success){ ?>
	Selamat pendaftaran telah berhasil, silahkan periksa email anda untuk mendapatkan nomor registrasi.
	
	<br />
	<br />
	<a href="<?php echo base_url();?>"> Back </a>
<?php } else { ?>
	

			<div class="largeCol" >
				<div class="innerpage_title_center" style='margin-top: -70px;margin-left:-10px;'>
					<div class="innerpage_title_transp">
						<h2>Formulir Pendaftaran Taruna Baru</h2>
						<span style="margin-left:44px;"><font style=color:red;><?php echo $msg;?></font></span>
					</div> 
				</div>
					<style>
					   label {
					    display:inline-block;
					    width:170px;
							padding:5px 0 5px 0;
					   }
					</style>
					
	<form id="form_pendaftaran" name="form_pendaftaran" class="form columns" action="<?php echo base_url();?>site/validate" method="POST" enctype="multipart/form-data";>
	<small class="error-desc" style="margin-left: 197px;">Semua Field bertanda (*) Wajib Diisi</small><br>
	
	<!--		
	<label>Nomor Pendaftaran</label>
		<input id="no_pendaftaran" name="no_pendaftaran" class="mandatory" type="text"  size="30" maxlength="30" value='<?php echo $data['no_pendaftaran'];?>' disabled="true"
			class="input-small input-tip"; /> Diisi Oleh System<br/>
	-->
	<!--
	<label>PIN</label>
	 
		<input id="pin" class="mandatory" name="pin" type="text"  size="30" maxlength="7" value='{$data.pin}' class="input-small input-tip" disabled="true"/>
		<font style=color:red;>*</font><br/>
		<input type="hidden" id="pin" 	name="pin" value="{$data.pin}"/>
			
		<input type="hidden" id="pin" name="pin" value="<?php //echo $pin;?>"/>
	-->
	<label>Nama Calon Taruna</label>
		<input id=nama name="nama" class="mandatory" type="text" value='<?php echo $data['nama'];?>' size="30" maxlength="30" class="input-small input-tip"; />
		<font style=color:red;>*</font><br/>

	<label>Tempat Lahir</label>
		<input id="tempat_lahir" name="tempat_lahir" class="mandatory" type="text" value='<?php echo $data['tempat_lahir'];?>' size="15" maxlength="15" class="input-small input-tip"; />
		<font style=color:red;>*</font><br/>

	<label for="select">Tanggal Lahir</label>
	
		<select id="tgl_lahir_dd" name="tgl_lahir_dd"  class="mandatory">
	  		<option value='0'>Pilih Tanggal</option>
				<?php
					$i=1;
					$j=$i + 30;
					for ($i; $i <= $j; $i++) {
						if($i == $data['tgl_lahir_dd'])
							echo "<option value='$i' selected >$i</option>";
						else
							echo "<option value='$i'>$i</option>";
					}
				?>
		</select>
	
		<select id="tgl_lahir_mm" name="tgl_lahir_mm" class="mandatory">
	  		<option value='0'>Pilih Bulan</option>
			  	<?php
			  		$bln = array( "1" => "Januari", "2" => "Februari", "3" =>"Maret", "4" => "April", "5" =>"Mei", "6" => "Juni", 
			  		"7" => "Juli", "8" => "Agustus", "9" => "September", "10" => "Oktober", "11" => "November", "12" => "Desember");
			  		
			  		foreach ($bln as $key => $value) {
						if($key == $data['tgl_lahir_mm'])
							echo "<option value='$key' selected >$value</option>";
						else
							echo "<option value='$key'>$value</option>";
					}
			  	?>
	  </select>
	  
		<select id="tgl_lahir_yy" name="tgl_lahir_yy" class="mandatory">
		  <option value='0'>Pilih Tahun</option>
			  	<?php
			  		$i=1988;
			  		$j=$i + 6;
			  		for ($i; $i <= $j; $i++) {
						if($i == $data['tgl_lahir_yy'])
							echo "<option value='$i' selected >$i</option>";
						else
							echo "<option value='$i'>$i</option>";
			  		}
			  	?>
		</select><font style=color:red;>*</font><br/>
		
	<label>Jenis Kelamin</label>
		<input id="jenis_kelamin" name="jenis_kelamin" type="radio" value="0" <?php if($data['jenis_kelamin'] == 0) echo 'checked'; ?> class="mandatory"/> Laki-laki
		<input id="jenis_kelamin"  name="jenis_kelamin" type="radio" value="1" <?php if($data['jenis_kelamin'] == 1) echo 'checked'; ?> class="mandatory"/> Perempuan
		<font style=color:red;>*</font><br/>

	<!--tinggi badan-->
	<label for="label4">Tinggi Badan</label>
		<select name="tinggi_badan" id="tinggi_badan" class="mandatory">
		  <option value='0'>Pilihan...</option>
				<?php
					$i=153;
					$j=$i + 32;
					for ($i; $i <= $j; $i++) {
						if($i == $data['tinggi_badan'])
							echo "<option value='$i' selected >$i</option>";
						else
							echo "<option value='$i'>$i</option>";
					}
				?>
		</select><font style=color:red;>*</font><br>
		
	<!--Agama-->
	<label for="label7">Agama</label>
		<select id="agama" name="agama" class="mandatory">
	  		<option value='0'>Pilihan...</option>
			<?php
				for($i=0; $i<count($agama); $i++) {
					if($data['agama'] == $agama[$i]['agamaID'])
						echo "<option value='" . $agama[$i]['agamaID'] . "' selected > " . $agama[$i]['code'] . " - " . $agama[$i]['agama'] . "</option>";	
					else
						echo "<option value='" . $agama[$i]['agamaID'] . "' > " . $agama[$i]['code'] . " - " . $agama[$i]['agama'] . "</option>";	
				}
			?>
		</select><font style=color:red;>*</font><br/>
	
	<!--propinsi asal-->
	<label for="label5">Propinsi Asal SMTA</label>

		<select id="propinsiID" name="propinsiID" class="mandatory" >
			<option value='0'>Pilihan...</option>
			<?php
				for($i=0; $i<count($propinsi); $i++) {
					if($data['propinsiID'] == $propinsi[$i]['propinsiID'])
						echo "<option value='" . $propinsi[$i]['propinsiID'] . "' selected > " . $propinsi[$i]['code'] . " - " . $propinsi[$i]['propinsi'] . "</option>";	
					else
						echo "<option value='" . $propinsi[$i]['propinsiID'] . "' > " . $propinsi[$i]['code'] . " - " . $propinsi[$i]['propinsi'] . "</option>";	
				}
			?>
		</select><font style=color:red;>*</font><br>
	
	<!--tahun lulus-->
	<label for="label6">Tahun Lulus SMTA</label>
		<select id="tahun_lulus" name="tahun_lulus" class="mandatory">
	  		<option value='0'>Pilihan...</option>
				<?php
					$i=1990;
					$j=$i + 21;
					for ($i; $i <= $j; $i++) {
						if($i == $data['tahun_lulus'])
							echo "<option value='$i' selected >$i</option>";
						else
							echo "<option value='$i'>$i</option>";
					}
				?>
		</select><font style=color:red;>*</font><br>
	
	<!--jenis smta-->
	<label for="label7">Jenis Asal SMTA</label>
		<select id="jenis_smtaID" name="jenis_smtaID" class="mandatory" onchange="changeValue()">
	  		<option value='0'>Pilihan...</option>
			<?php
				for($i=0; $i<count($jenisSmta); $i++) {
					if($data['jenis_smtaID'] == $jenisSmta[$i]['jenis_smtaID'])
						echo "<option value='" . $jenisSmta[$i]['jenis_smtaID'] . "' selected > " . $jenisSmta[$i]['code'] . " - " . $jenisSmta[$i]['jenis'] . "</option>";	
					else
						echo "<option value='" . $jenisSmta[$i]['jenis_smtaID'] . "' > " . $jenisSmta[$i]['code'] . " - " . $jenisSmta[$i]['jenis'] . "</option>";	
				}
			?>
		</select><font style=color:red;>*</font><br/>
	
	<!--jurusan SMTA-->
	<label for="label8">Jurusan SMTA</label>
		<select id="jurusan_smtaID" name="jurusan_smtaID" class="mandatory">
	  		<option value='0'>Pilihan...</option>
			<?php
				for($i=0; $i<count($jurusanSmta); $i++) {
					if($data['jurusan_smtaID'] == $jurusanSmta[$i]['jurusan_smtaID'])
						echo "<option value='" . $jurusanSmta[$i]['jurusan_smtaID'] . "' selected > " . $jurusanSmta[$i]['code'] . " - " . $jurusanSmta[$i]['jurusan'] . "</option>";	
					else
						echo "<option value='" . $jurusanSmta[$i]['jurusan_smtaID'] . "' > " . $jurusanSmta[$i]['code'] . " - " . $jurusanSmta[$i]['jurusan'] . "</option>";	
				}
			?>
		</select><font style=color:red;>*</font><br>
		 
	<!--pilihan jurusan-->
	<label id="jurusanID_desc">Pilihan Jurusan</label>
		<select id="jurusanID" name="jurusanID" class="mandatory">
			<option value='0'>Pilihan...</option>
			<?php
				for($i=0; $i<count($jurusan); $i++) {
					if($data['jurusanID'] == $jurusan[$i]['jurusanID'])
						echo "<option value='" . $jurusan[$i]['jurusanID'] . "' selected > " . $jurusan[$i]['code'] . " - " . $jurusan[$i]['jurusan'] . "</option>";	
					else
						echo "<option value='" . $jurusan[$i]['jurusanID'] . "' > " . $jurusan[$i]['code'] . " - " . $jurusan[$i]['jurusan'] . "</option>";	
				}
			?>
		</select><font style=color:red;>*</font><br>
	
	<!--pilihan lokasi test-->
	<label id="lokasiTKD_label">Pilihan Lokasi Tes TKD</label>
		<select id="lokasiTKD" name="lokasiTKD" class="mandatory">
			<option value='0'>Pilihan...</option>
			<?php
				for($i=0; $i<count($lokasiTKD); $i++) {
					if($data['lokasiTKD'] == $lokasiTKD[$i]['ref_lokasi_tkd_id'])
						echo "<option value='" . $lokasiTKD[$i]['ref_lokasi_tkd_id'] . "' selected > " . $lokasiTKD[$i]['code'] . " - " . $lokasiTKD[$i]['lokasi'] . "</option>";	
					else
						echo "<option value='" . $lokasiTKD[$i]['ref_lokasi_tkd_id'] . "' > " . $lokasiTKD[$i]['code'] . " - " . $lokasiTKD[$i]['lokasi'] . "</option>";	
				}
			?>
		</select><font style=color:red;>*</font><br>
			
		<!--pilihan lokasi test-->
	<label id="lokasiTKA_label">Pilihan Lokasi Tes TKA</label>
		<select id="lokasiTKA" name="lokasiTKA" class="mandatory" onchange="changeValueTKA()">
			<option value='0'>Pilihan...</option>
			<?php
				for($i=0; $i<count($lokasiTKA); $i++) {
					if($data['lokasiTKA'] == $lokasiTKA[$i]['ref_lokasi_tka_id'])
						echo "<option value='" . $lokasiTKA[$i]['ref_lokasi_tka_id'] . "' selected > " . $lokasiTKA[$i]['code'] . " - " . $lokasiTKA[$i]['lokasi'] . "</option>";	
					else
						echo "<option value='" . $lokasiTKA[$i]['ref_lokasi_tka_id'] . "' > " . $lokasiTKA[$i]['code'] . " - " . $lokasiTKA[$i]['lokasi'] . "</option>";	
				}
			?>
		</select><font style=color:red;>*</font><br>
		<input type="hidden" id="kota" 	name="kota" value=""/>
	
	<!--
		<label>No Sertifikat TKD</label>
		<input id="no_tkd" name="no_tkd" class="mandatory" type="text" size="15" maxlength="15" class="input-small input-tip"; value='<?php echo $data['no_tkd'];?>' />
		<font style=color:red;>*</font><br/>
	--> 
	 
		<!--nilai keterangan isi-->
	<!--
	<label>&nbsp;</label>
		<font style=color:red;>* masukkan No TKD yang anda dapatkan di BKN</font>
	<br/>
	-->
	<br/>
	<!--nilai title -->
	<label>&nbsp;</label>

		<input type="text"  size="10" value="Matematika" class="input-small1"; readonly; disabled='true'"/> 
		<input type="text"  size="10" value="Fisika" class="input-small1"; readonly; disabled='true'"/> 
		<input type="text"  size="10" value="Bhs. Inggris" class="input-small1"; readonly; disabled='true'"/> 


	<br/>

	<!--Semester 2 Kelas 11-->
	<label>Nilai Semester 2 Kls 11</label>

		<input id="mat_4"  name="mat_4" type="text"  value='<?php echo $data['mat_4'];?>' size="10" maxlength="3" class="input-small1" class="mandatory"/> 
		<input id="fisika_4" name="fisika_4" type="text"  value='<?php echo $data['fisika_4'];?>' size="10" maxlength="3" class="input-small1" class="mandatory"/> 
		<input id="inggris_4" name="inggris_4" type="text"  value='<?php echo $data['inggris_4'];?>' size="10" maxlength="3" class="input-small1" class="mandatory"/>
	<font style=color:red;>*</font><br/>
	
	
	<!--Semester 1 Kelas 12-->
	<label for="label11">Nilai Semester 1 Kls 12</label>
		<input id="mat_5"  name="mat_5" type="text"  value='<?php echo $data['mat_5'];?>' size="10" maxlength="3" class="input-small1" class="mandatory"/> 
		<input id="fisika_5" name="fisika_5" type="text"  value='<?php echo $data['fisika_5'];?>' size="10" maxlength="3" class="input-small1" class="mandatory"/> 
		<input id="inggris_5" name="inggris_5" type="text"  value='<?php echo $data['inggris_5'];?>' size="10" maxlength="3" class="input-small1" class="mandatory"/> 
	<font style=color:red;>*</font><br/>
	
	<!--Semester 2 Kelas 12-->
	<label for="label11">Nilai Semester 2 Kls 12</label>
		<input id="mat_6" name="mat_6" type="text"  value='<?php echo $data['mat_6'];?>' size="10" maxlength="3" class="input-small1" class="mandatory"/> 
		<input id="fisika_6" name="fisika_6" type="text"  value='<?php echo $data['fisika_6'];?>' size="10" maxlength="3" class="input-small1" class="mandatory"/> 
		<input id="inggris_6" name="inggris_6" type="text"  value='<?php echo $data['inggris_6'];?>' size="10" maxlength="3" class="input-small1" class="mandatory"/> 
	<font style=color:red;>*</font>
	<br/>
	
	<!--nilai keterangan isi-->
	<label>&nbsp;</label>
		<font style=color:red;>* nilai diisi dengan angka, skala 0,0-10,0. Mis : fisika = 7,5</font>
	<br/>
	
	<label>Nama Orang Tua</label>
		<input id=ayah name="ayah" class="mandatory" type="text" value='<?php echo $data['ayah'];?>' size="30" maxlength="30" class="input-small input-tip" title="Ayah"; onfocus="if(this.value=='Nama Ayah') this.value='';" placeholder="Nama Ayah" />
		<font style=color:red;>*</font><br/>
		
	<label>&nbsp;</label>
		<input id=ibu name="ibu" class="mandatory" type="text" value='<?php echo $data['ibu'];?>' size="30" maxlength="30" class="input-small input-tip" title="Ibu"; onfocus="if(this.value=='Nama Ibu') this.value='';" placeholder="Nama Ibu" />
		<font style=color:red;>*</font><br/>
		
	<label>Alamat Rumah</label>
		<textarea id=alamat name="alamat" class="mandatory" type="text" value='' size="200" maxlength="200" class="input-large input-tip" cols="27" rows="4"; ><?php echo $data['alamat'];?></textarea>
		<font style=color:red;>*</font><br/>
	
	<label>Kode Pos</label>
		<input id=kodepos name="kodepos" class="mandatory" type="text" value='<?php echo $data['kodepos'];?>' size="30" maxlength="10" class="input-small input-tip"; />
		<font style=color:red;>*</font><br/>
		
	<label>Telepon / HP</label>
		<input id=telepon name="telepon" class="mandatory" type="text" value='<?php echo $data['telepon'];?>' size="30" maxlength="40" class="input-small input-tip"; />
		<font style=color:red;>*</font><br/>
		
	<label>Email</label>
		<input id=email name="email" class="mandatory" type="text" value='<?php echo $data['email'];?>' size="30" maxlength="30" class="input-small input-tip"; />
		<font style=color:red;>*</font><br/>
		
	<label>Foto</label>
				<input type="file" id="foto" name="foto" class="input-small1" class="mandatory" size="22" maxlength="30" />
				<font style=color:red;>*</font>
				<br style="height:5px;line-height:5px;"><br style="height:5px;line-height:5px;">
				
				<!-- klo ada foto, tampilkan -->
				<?php
				if(strlen($img_1) > 0) {
					//echo $img_1 . '<br/>';
					echo "<img src='". base_url(). $img_1. "' alt='Foto Utama' style='margin-left: 207px; max-width:150px;' />";
				}
				?>
				
			<p style="margin-left:35px;">
			<input id="agree" name="agree" type="checkbox" value='1' class="mandatory"/>
			<font style=color:red;>Dengan ini, Saya menyatakan bahwa data yang Saya masukkan adalah 
			data yang sebenarnya, apabila data yang saya masukkan tidak sesuai dengan fakta yang sesungguhnya maka 
			Saya bersedia didiskualifikasi.
			</font>
			</p><br><br />
			
      <label>&nbsp;</label>
      <label style="margin-left:0px; padding:0; width:90px;" >
			<!--<button id="btnsave" value="save" type="submit"/>Daftar</button>-->
			<button onclick="myFunction()">Submit</button>
			</label>

			<label style="margin-left:5px; padding:0; width:80px;">
			<!--<button id="back" value="back" type="reset"/>Reset</button>-->
			<button onclick="myFunction()" id="back" value="back" type="reset">Reset</button>
			</label>
			
			<label style="margin-left:10px; padding:0; width:200px;">
			<!--<a class="button" href="{$site.site}site/informasi/pendaftaran" target="_blank">Syarat Pendaftaran</a>-->
			<a class="button" onclick="myFunction()" href="<?php echo base_url();?>site/persyaratan" target="_blank">Syarat Pendaftaran</a>
			</a>
			</label>
</form>
<br>


<p id="demo"></p>

<script>
function myFunction()
{
var x;
var r=confirm("Apakah anda yakin bahwa data yang dimasukkan telah diisi dengan benar?");
if (r==true)
  {
  x="You pressed OK!";
  }
else
  {
  x="You pressed Cancel!";
  }
document.getElementById("demo").innerHTML=x;
}
</script>






<?php  } ?>
			</div>
	  </div>
	<!-- Content end -->


<script type="text/Javascript">
  function changeValue() {    
    var jenis_smtaID = document.getElementById("jenis_smtaID");
	var jurusan_smtaID = document.getElementById("jurusan_smtaID");
	var options = jurusan_smtaID.getElementsByTagName("option");
	
	jurusan_smtaID.selectedIndex = 0;
	
    if (jenis_smtaID.value == "1") {
		for(var i=1; i<options.length; i++) {
			 options[i].disabled = i != "1" ? true : false;
		}
    } else if (jenis_smtaID.value == "2") {
		for(var i=1; i<options.length; i++) {
			 options[i].disabled = i == "1" ? true : false;
		}
    } else if (jenis_smtaID.value == "3") {
		for(var i=1; i<options.length; i++) {
			 options[i].disabled = i == "1" ? true : false;
		}
    } else {
		for(var i=1; i<options.length; i++) {
			 options[i].disabled = true;
		}
	}
  }
  
  function changeValueTKA() {
	var x = document.getElementById("lokasiTKA").selectedIndex;
	var y = document.getElementById("lokasiTKA").options;
	
	var kota = y[x].text;
	kota = kota.substr(5);
	document.getElementById("kota").value = kota;
  }
  
  function firstLoad() {
	var jurusan_smtaID = document.getElementById("jurusan_smtaID");
	var options = jurusan_smtaID.getElementsByTagName("option");
	
	for(var i=1; i<options.length; i++) {
		 options[i].disabled = true;
	}
  }
  
  window.onload = firstLoad();
</script>

<style>
select option[disabled] {
    display: none;
}
</style>

</div>


  </div>
</div>
 

<?php include 'site_footer.php'; ?>

